package com.ruoyi.group.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.group.domain.listChangeTime;
import com.ruoyi.group.service.IlistChangeTimeService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 工单转接Controller
 * 
 * @author yb
 * @date 2022-03-12
 */
@RestController
@RequestMapping("/listChangeTime/listChangeTime")
public class listChangeTimeController extends BaseController
{
    @Autowired
    private IlistChangeTimeService listChangeTimeService;

    /**
     * 查询工单转接列表
     */
    @PreAuthorize("@ss.hasPermi('listChangeTime:listChangeTime:list')")
    @GetMapping("/list")
    public TableDataInfo list(listChangeTime listChangeTime)
    {
        startPage();
        List<listChangeTime> list = listChangeTimeService.selectlistChangeTimeList(listChangeTime);
        return getDataTable(list);
    }

    /**
     * 导出工单转接列表
     */
    @PreAuthorize("@ss.hasPermi('listChangeTime:listChangeTime:export')")
    @Log(title = "工单转接", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, listChangeTime listChangeTime)
    {
        List<listChangeTime> list = listChangeTimeService.selectlistChangeTimeList(listChangeTime);
        ExcelUtil<listChangeTime> util = new ExcelUtil<listChangeTime>(listChangeTime.class);
        util.exportExcel(response, list, "工单转接数据");
    }

    /**
     * 获取工单转接详细信息
     */
    @PreAuthorize("@ss.hasPermi('listChangeTime:listChangeTime:query')")
    @GetMapping(value = "/{repairId}")
    public AjaxResult getInfo(@PathVariable("repairId") Integer repairId)
    {
        return AjaxResult.success(listChangeTimeService.selectlistChangeTimeByRepairId(repairId));
    }

    /**
     * 新增工单转接
     */
    @PreAuthorize("@ss.hasPermi('listChangeTime:listChangeTime:add')")
    @Log(title = "工单转接", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody listChangeTime listChangeTime)
    {
        return toAjax(listChangeTimeService.insertlistChangeTime(listChangeTime));
    }

    /**
     * 修改工单转接
     */
    @PreAuthorize("@ss.hasPermi('listChangeTime:listChangeTime:edit')")
    @Log(title = "工单转接", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody listChangeTime listChangeTime)
    {
        return toAjax(listChangeTimeService.updatelistChangeTime(listChangeTime));
    }

    /**
     * 删除工单转接
     */
    @PreAuthorize("@ss.hasPermi('listChangeTime:listChangeTime:remove')")
    @Log(title = "工单转接", businessType = BusinessType.DELETE)
	@DeleteMapping("/{repairIds}")
    public AjaxResult remove(@PathVariable Integer[] repairIds)
    {
        return toAjax(listChangeTimeService.deletelistChangeTimeByRepairIds(repairIds));
    }
}
